﻿@model DJH.School.Common.PaginatedList<DJH.School.Core.Models.Student>

@{
    ViewData["Title"] = "学生列表";
}

<h2>学生列表</h2>

<p>
    <a asp-action="Create">添加</a>
</p>
<form class="form-inline" asp-action="Index" role="form" method="get">
    <div class="form-group">
        <label class="control-label">姓名：</label>
        <input type="text" class="form-control" width="200" name="searchStudent" value="@ViewData["searchStudent"]" />
        <input type="submit" value="搜索" class="btn btn-default" />
        <a asp-action="Index" class="btn btn-default">返回列表</a>
    </div>
</form>
<table class="table">
    <thead>
        <tr>
            <th>
                <a asp-action="Index" asp-route-sortOrder="@ViewData["Name_Sort_Param"]">姓名</a>
            </th>
            <th>
                <a asp-action="Index" asp-route-sortOrder="@ViewData["Date_Sort_Param"]">注册时间</a>
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.RealName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.EnrollmentDate)
                </td>
                <td>
                    <a asp-action="Edit" asp-route-id="@item.Id">编辑</a> |
                    <a asp-action="Details" asp-route-id="@item.Id">详细</a> |
                    <a asp-action="Delete" asp-route-id="@item.Id">删除</a>
                </td>
            </tr>
        }
    </tbody>
</table>
@{
    var lastDisable = Model.HasLastPage ? "" : "disabled";
    var nextDisable = Model.HasNextPage ? "" : "disabled";
}
<a asp-action="Index" class="btn btn-default @lastDisable" asp-route-sortOrder="@ViewData["SearchStudent"]" asp-route-page="@(Model.PageIndex - 1)" asp-route-currentStudent="@ViewData["currentStudent"]">上一页</a>
<a asp-action="Index" class="btn btn-default @nextDisable" asp-route-sortOrder="@ViewData["SearchStudent"]" asp-route-page="@(Model.PageIndex + 1)" asp-route-currentStudent="@ViewData["currentStudent"]">下一页</a>